<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 7.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/ME.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/ME.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/ME.ico">
  <link rel="mask-icon" href="/images/ME.ico" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"www.zhoubencheng.com","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="树莓派硬件结构 树莓派4B硬件结构   DSI(Display serial interface)视频信号传输接口，将视频信号从处理器传输到显示器的一种高速串行接口 POE(Power Over Ethernet)以太网供电，是一种在同一根以太网电缆上传输数据和电力的技术，这种技术使得网络设备如AP、IP摄像头等无需单独的电源线，只需要通过以太网电网缆线就能获得电力供应">
<meta property="og:type" content="article">
<meta property="og:title" content="电子技术实习">
<meta property="og:url" content="http://www.zhoubencheng.com/2024/06/29/%E7%94%B5%E5%AD%90%E6%8A%80%E6%9C%AF%E5%AE%9E%E4%B9%A0%EF%BC%88%E8%80%83%E5%89%8D%E9%A2%84%E4%B9%A0%E7%89%88%EF%BC%89/index.html">
<meta property="og:site_name" content="Benson&#39;s blog">
<meta property="og:description" content="树莓派硬件结构 树莓派4B硬件结构   DSI(Display serial interface)视频信号传输接口，将视频信号从处理器传输到显示器的一种高速串行接口 POE(Power Over Ethernet)以太网供电，是一种在同一根以太网电缆上传输数据和电力的技术，这种技术使得网络设备如AP、IP摄像头等无需单独的电源线，只需要通过以太网电网缆线就能获得电力供应">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.postimg.cc/MTNKBtwD/4B.png">
<meta property="og:image" content="https://i.postimg.cc/44H3GCvF/image.png">
<meta property="og:image" content="https://i.postimg.cc/W3BTz3mY/Waveforms-svg.png">
<meta property="og:image" content="https://i.postimg.cc/rpp8Y7Fj/PWM-3-level-svg.png">
<meta property="og:image" content="https://i.postimg.cc/RVcV3cD7/I2C.png">
<meta property="og:image" content="https://i.postimg.cc/4Ntn6Cmh/image.png">
<meta property="og:image" content="https://i.postimg.cc/g0M0zmB1/image.png">
<meta property="og:image" content="https://i.postimg.cc/7LQxvX5k/SPI.webp">
<meta property="og:image" content="https://i.postimg.cc/x8mj3HTS/image.jpg">
<meta property="og:image" content="https://i.postimg.cc/6pf3PdVW/image.jpg">
<meta property="og:image" content="https://i.postimg.cc/NM5jLS3F/image.jpg">
<meta property="og:image" content="https://i.postimg.cc/Vkgfgz15/PCF.jpg">
<meta property="og:image" content="https://i.postimg.cc/MTMzzRBj/PCF.png">
<meta property="og:image" content="https://i.postimg.cc/qv4B2zP9/PCF.jpg">
<meta property="og:image" content="https://i.postimg.cc/ZKk5KfVY/MPU.jpg">
<meta property="og:image" content="https://i.postimg.cc/xdjCVcgK/800px-Hsl-hsv-models-svg.png">
<meta property="og:image" content="https://i.postimg.cc/Hkgn3Syv/image.jpg">
<meta property="article:published_time" content="2024-06-29T08:26:53.000Z">
<meta property="article:modified_time" content="2024-07-05T07:05:03.941Z">
<meta property="article:author" content="Benson">
<meta property="article:tag" content="硬件">
<meta property="article:tag" content="树莓派">
<meta property="article:tag" content="课内复习">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.postimg.cc/MTNKBtwD/4B.png">

<link rel="canonical" href="http://www.zhoubencheng.com/2024/06/29/%E7%94%B5%E5%AD%90%E6%8A%80%E6%9C%AF%E5%AE%9E%E4%B9%A0%EF%BC%88%E8%80%83%E5%89%8D%E9%A2%84%E4%B9%A0%E7%89%88%EF%BC%89/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>电子技术实习 | Benson's blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>


<style>.github-emoji { position: relative; display: inline-block; width: 1.2em; min-height: 1.2em; overflow: hidden; vertical-align: top; color: transparent; }  .github-emoji > span { position: relative; z-index: 10; }  .github-emoji img, .github-emoji .fancybox { margin: 0 !important; padding: 0 !important; border: none !important; outline: none !important; text-decoration: none !important; user-select: none !important; cursor: auto !important; }  .github-emoji img { height: 1.2em !important; width: 1.2em !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; user-select: none !important; cursor: auto !important; } .github-emoji-fallback { color: inherit; } .github-emoji-fallback img { opacity: 0 !important; }</style>
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Benson's blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">最好的安排</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

  <a href="https://github.com/ZhouBencheng" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.zhoubencheng.com/2024/06/29/%E7%94%B5%E5%AD%90%E6%8A%80%E6%9C%AF%E5%AE%9E%E4%B9%A0%EF%BC%88%E8%80%83%E5%89%8D%E9%A2%84%E4%B9%A0%E7%89%88%EF%BC%89/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/ME.ico">
      <meta itemprop="name" content="Benson">
      <meta itemprop="description" content="Share my thoughts with you">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Benson's blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          电子技术实习
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2024-06-29 16:26:53" itemprop="dateCreated datePublished" datetime="2024-06-29T16:26:53+08:00">2024-06-29</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2024-07-05 15:05:03" itemprop="dateModified" datetime="2024-07-05T15:05:03+08:00">2024-07-05</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/USTB-courses/" itemprop="url" rel="index"><span itemprop="name">USTB courses</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="树莓派硬件结构">树莓派硬件结构</h2>
<h3 id="树莓派4b硬件结构">树莓派4B硬件结构</h3>
<p><img src="https://i.postimg.cc/MTNKBtwD/4B.png" style="zoom:80%;"></p>
<ul>
<li>DSI(Display serial
interface)<strong>视频信号</strong>传输接口，将视频信号从处理器传输到显示器的一种高速<strong>串行</strong>接口</li>
<li>POE(Power Over
Ethernet)以太网供电，是一种在同一根以太网电缆上传输数据和电力的技术，这种技术使得网络设备如AP、IP摄像头等无需单独的电源线，只需要通过以太网电网缆线就能获得电力供应
<span id="more"></span> 以下是树莓派引脚图</li>
</ul>
<p><img src="https://i.postimg.cc/44H3GCvF/image.png" style="zoom:67%;"></p>
<ul>
<li>彩色编号为BCM编号，使用的是Boardcom SOC上的编号</li>
<li>灰色为BOARD编号，是树莓派上实际的物理编号</li>
</ul>
<h3 id="pwmpulse-width-modulation">PWM(Pulse-width modulation)</h3>
<p>脉冲宽度调制器，简称脉宽调制，PWM技术是一种将<strong>模拟</strong>信号电平进行<strong>数字</strong>编码的技术。</p>
<p>不同于模拟电路，数字电路只需要通过电流/电压的通断形成的重复脉冲序列就可以进行信号表示，而模拟电路表示的模拟信号有诸多问题：难以调制、功耗大、易受噪声和环境干扰等。PWM技术则通过调制<strong>方波</strong>的<strong>占空比</strong>来实现对<strong>模拟</strong>信号的<strong>数字</strong>编码，</p>
<blockquote>
<p>方波：方波是一种非正弦曲线的波形，理想方波只有高低两个值，下图第二个是方波示例</p>
<p><img src="https://i.postimg.cc/W3BTz3mY/Waveforms-svg.png" style="zoom:67%;"></p>
</blockquote>
<blockquote>
<p>占空比(duty
cycle)：表示在一个周期内，<strong>工作时间</strong>和<strong>总时间</strong>的占比。这是一个宽泛的定义，以下是在不同情境中具体的定义</p>
<ul>
<li>在一串理想的脉冲序列（方波）中，占空比表示正脉冲持续时间和脉冲总时间的比值</li>
<li>在周期性现象中，现象发生时间和总时间的比值</li>
</ul>
</blockquote>
<p>通过PWM技术对模拟信号进行数字化调制，我们可以使用数字信号进行更加准确的传输，并在最后将数字信号调制为准模拟信号，以下是PWM调制过程（有点积分的感觉，方波积分得到模拟信号bushi）</p>
<p><img src="https://i.postimg.cc/rpp8Y7Fj/PWM-3-level-svg.png" style="zoom:67%;"></p>
<h3 id="i2c通信协议inter-integrated-circuit">I2C通信协议(Inter-Integrated
Circuit)</h3>
<h4 id="通信方式">通信方式</h4>
<p>I2C通信协议是一种<strong>半双工同步</strong>通信协议</p>
<ul>
<li>同步：接收端和发送端时钟频率一致</li>
<li>半双工：能够双向通信，但通信双方不能同时进行数据收发，在同一时刻只有一方发送另一方接收</li>
</ul>
<h4 id="数据格式">数据格式</h4>
<p>I2C通信的数据包大小为8bit，分为三类</p>
<ul>
<li>指令：7位从机地址 + 1位读写命令</li>
<li>数据：8位数据</li>
<li>字节地址：8位字节地址，从这个地址开始读数据</li>
</ul>
<h4 id="信号含义">信号含义</h4>
<p>I2C使用串行通信方式，使用<strong>数据线SDA</strong>和<strong>时钟线SCL</strong>两条线进行同步半双工通信，由SDA和ASCL两条线确定的信号状态分为以下5种</p>
<ul>
<li><strong>空闲状态</strong>：当I2C的SDA和SCL两条线<strong>都</strong>处于<strong>高电平</strong>时，规定总线为空闲状态</li>
<li><strong>启动信号</strong>：当SCL中处于高电平，数据线SDA走向<strong>下降沿</strong>，表示一次数据传输的开始</li>
<li><strong>停止信号</strong>：当SCL中处于高电平，数据线SDA走向<strong>上升沿</strong>，表示一次数据传输的结束</li>
<li><strong>数据传输</strong>（按位串行）：在SCL每一个高电平期间对SDA数据线中的一位数据进行采样，这要求SDA在SCL高电平期间不能改变；只有在SCL低电平期间，SDA上的数据才能改变</li>
<li><strong>应答信号</strong>：I2C所有数据都是8bit传输，发送器(transmitter)每发送一个字节，在第9个时钟<strong>开始</strong>时释放数据线，由接收器（receiver）反馈一个接收信号。在第9个时钟脉冲之前（高电平之前），接收器改变SDA电平，当应答信号为低电平时为有效应答位(ACK)，当应答信号为高电平时为无效应答位(NACK)</li>
</ul>
<p><img src="https://i.postimg.cc/RVcV3cD7/I2C.png" style="zoom: 80%;"></p>
<blockquote>
<p>SDA和SCL数据线均通过<strong>上拉电阻</strong>接入VCC</p>
<p>上拉电阻</p>
<p><img src="https://i.postimg.cc/4Ntn6Cmh/image.png" style="zoom: 50%;"></p>
<p>下拉电阻</p>
<p><img src="https://i.postimg.cc/g0M0zmB1/image.png" style="zoom:50%;"></p>
</blockquote>
<h3 id="其他通信协议">其他通信协议</h3>
<ul>
<li><p>SPI(Serial Periperal
Interface)串行外设接口：是一种<strong>同步</strong>、<strong>全双工</strong>、<strong>串行</strong>、<strong>主从结构</strong>的通信协议，通过四根总线通信</p>
<ul>
<li>CS：主机对从机的片选信号，因为SPI允许多个从机连接至主机</li>
<li>SCLK：主机向从机发送的时钟信号</li>
<li>MOSI：master 发送给 slave的数据信号</li>
<li>MISO：salve 发送给 master 的数据信号</li>
</ul>
<p><img src="https://i.postimg.cc/7LQxvX5k/SPI.webp"></p></li>
<li><p>1-Wire单总线协议：主机和从机采用一根总线进行通信，该总线可以传输<strong>时钟和数据</strong>，却传输方向是<strong>双向</strong>的。使用该协议的传感器模块有DHT11温湿度传感器和DS18B20温度传感器</p></li>
</ul>
<h2 id="第三方库rpi.gpio库编程">第三方库RPi.GPIO库编程</h2>
<h3 id="引脚用法">引脚用法</h3>
<p><code>GPIO.setmode(mode)</code></p>
<ul>
<li><p><code>@brief</code>： 用于设置GPIO引脚编码方式</p></li>
<li><p><code>@param</code>：设置可用的引脚编码方式，可以用<code>GPIO.BCM</code>和<code>GPIO.BOARD</code>两种</p></li>
</ul>
<p><code>GPIO.setwarnings(bool)</code></p>
<ul>
<li><code>@brief</code>：用于忽视GPIO端口的警告</li>
<li><code>@param</code>：可设置为<code>True</code>和<code>False</code>两种</li>
</ul>
<p><code>GPIO.setup(channel, mode)</code></p>
<ul>
<li><code>@brief</code>：通道设置方法，可以设置一个或者多个管脚的输入输出模式</li>
<li><code>@param pins</code>：
可以使用单个引脚编号，或使用<strong>列表</strong>或者<strong>元组</strong>组合的引脚组</li>
<li><code>@param mode</code>：可设置为<code>GPIO.IN GPIO.OUT GPIO.BOTH</code>三种</li>
</ul>
<p><code>GPIO.input(channel)</code></p>
<ul>
<li><code>@brief</code>：获取引脚的值</li>
<li><code>@return</code>：<code>0/GPIO.LOW/False</code> 或
<code>1/GPIO.HIGH/True</code></li>
</ul>
<p><code>GPIO.output(channel, val)</code></p>
<ul>
<li><code>@brief</code>：输出到引脚的值，参数同理<code>GPIO.input</code></li>
</ul>
<h3 id="pwm脉冲使用"><code>PWM</code>脉冲使用</h3>
<p><code>p = GPIO.PWM(channel, freq)</code></p>
<ul>
<li><code>@brief</code>：获取对管脚的PWM控制权，创建PWM实例</li>
<li><code>@return</code>：<code>p = GPIO.PWM(pin, freq)</code></li>
</ul>
<p><code>p.start(dc)</code></p>
<ul>
<li><code>@brief</code>：设置该管脚PWM的<strong>占空比</strong></li>
<li><code>@param</code>：<code>100 &gt;= dc &gt;= 0</code></li>
</ul>
<p><code>p.ChangeFreqency(freq)</code></p>
<ul>
<li><code>@brief</code>：改变管脚的脉冲频率</li>
<li><code>@param</code>：<code>freq</code>单位为Hz</li>
</ul>
<p><code>p.ChangeDutyCycle(dc)</code></p>
<ul>
<li><code>@brief</code>：改变管脚的PWM占空比</li>
</ul>
<h2 id="传感器模块">传感器模块</h2>
<h3 id="蜂鸣器">蜂鸣器</h3>
<p><img src="https://i.postimg.cc/x8mj3HTS/image.jpg" style="zoom: 80%;"><img src="https://i.postimg.cc/6pf3PdVW/image.jpg" style="zoom: 80%;"></p>
<p>​ 有源蜂鸣器 无源蜂鸣器</p>
<p><strong>有源蜂鸣器</strong>发出单一的提示警报，没有频率变化。<strong>无源蜂鸣器</strong>的驱动为脉冲频率驱动，可以发出各种有频率的声音</p>
<h3 id="旋转编码器">旋转编码器</h3>
<p><img src="https://i.postimg.cc/NM5jLS3F/image.jpg" style="zoom:50%;"></p>
<p>管脚介绍</p>
<ul>
<li>GND/VCC：接地/电源接口</li>
<li>SW管脚可用于实现<strong>按键</strong>效果，当按下旋转编码器的轴时，SW的电平被拉低，表示一个按键按下事件</li>
<li>CLK(A
output)管脚输出<strong>方波脉冲</strong>，当旋转编码器旋转时，该引脚产生高低变化的信号，该信号可用于计数脉冲，确定旋转的步数或者角度</li>
<li>DT(B
output)管脚同样输出方波脉冲，但是和CLK管脚的脉冲有<strong>90度的相位差</strong>，该相位差可用于检测旋转方向</li>
</ul>
<h3 id="pcf8591">PCF8591</h3>
<p>PCF8591是一个具有4个模拟输入、1个模拟输出的8位模数转换器(ADC)和数模转换器(DAC)</p>
<p><img src="https://i.postimg.cc/Vkgfgz15/PCF.jpg"></p>
<p><strong>管脚介绍</strong></p>
<ul>
<li>AIN0、AIN1、AIN2、AIN3：模拟电路输入接口</li>
<li>AOUT：模拟信号输出接口，用于数模转换</li>
<li>GND：接地</li>
<li>SCL：I2C通信输出接口</li>
</ul>
<p><strong>PCF8591控制字</strong></p>
<p><img src="https://i.postimg.cc/MTMzzRBj/PCF.png"></p>
<ul>
<li>如上图，D7和D3恒为0，作为芯片扩展位</li>
<li>D6为<strong>模拟输出</strong>使能位</li>
<li>D2为自动增量模式使能位</li>
<li>D4、D5为模拟输入模式选择位
<ul>
<li>00：四路单端输入</li>
<li>01：三路差分输入</li>
<li>10：单端和差分配合输入</li>
<li>11：两路差分输入</li>
</ul></li>
<li>D0、D1为输入引脚选择位，0～3分别对应AIN0 AIN1 AIN2 AIN3</li>
</ul>
<p><strong>PCF8591物理地址</strong></p>
<p><img src="https://i.postimg.cc/qv4B2zP9/PCF.jpg"></p>
<p>已知在PCF8591物理地址的编址中，总共用<strong>7位</strong>表示物理地址，其中前4位为<strong>固定位wilidz1001</strong>，<strong>可编程位</strong>A0
A1
A2三位。注意最低位为<strong>方向位|读写位（决定数据传输方向）</strong>，且该低位<strong>不算在物理地址中</strong></p>
<p><strong>PCF8591芯片引脚</strong>（它真考啊哥们儿，考完含泪记下）</p>
<ul>
<li><code>VREF</code>：基准电源端</li>
<li><code>OSC</code>：外部时钟输入端，内部时钟输出端</li>
<li><code>EXT</code>：内部外部时钟选择线，使用内部时钟时EXT接地</li>
<li><code>VSS</code>：接电源负极，即GND</li>
<li><code>AGND</code>：模拟信号地</li>
<li>其他引脚在上面介绍过</li>
</ul>
<h3 id="mpu6050陀螺仪加速度传感器">MPU6050陀螺仪加速度传感器</h3>
<p>MPU6050是一款完整的6轴运动跟踪设备，其中6轴包括三轴陀螺仪和三轴加速度计。此外，注意MPU6050还有片上温度传感器，且具备I2C总线接口。I2C总线可以与其他传感器进行通信，如果将三轴磁力计连接到辅助I2C设备，MPU6050模块可以通过其内部的数字运动处理器DMP将不同传感器的运动数据融合，得到完整的9轴Motion
Fusion输出。</p>
<p><img src="https://i.postimg.cc/ZKk5KfVY/MPU.jpg"></p>
<p>管脚介绍</p>
<ul>
<li>VCC</li>
<li>SCL：I2C通信数据线</li>
<li>XCL(Auxiliary)：辅助I2C数据线，用于外部连接磁力计传感器，通过该辅助I2C总线，允许MPU6050直接控制外部传感器的时钟信号</li>
<li>AD0：I2C地址选择引脚，将此引脚接地时，I2C地址为0x68，当该引脚连接到VCC时，I2C地址为0x69，这允许再同一I2C总线上连接多个MPU6050设备</li>
</ul>
<p>模块构成</p>
<ul>
<li>三轴陀螺仪(Three-axis Gyroscope)：测量设备在X, Y,
Z三轴上的<strong>角速度</strong></li>
<li>三轴加速度计(Three-axis
Accelerometer)：测量三周上的<strong>加速度</strong></li>
<li>数字运动处理器(Digital Motion
Processer)：处理和融合以上两者的数据，做出<strong>姿态估计</strong>、运动检测、方向检测等</li>
<li>温度传感器：测量内部温度，提供温度补偿</li>
<li>I2C通信接口：和主处理器进行通信</li>
</ul>
<blockquote>
<p>MPU6050可以通过陀螺仪和加速度计的测量计算出姿态角，姿态角由三个旋转角度构成</p>
<ul>
<li>滚旋角(Roll)：飞机绕前后轴的旋转角度，通常为-180°~180°</li>
<li>俯仰角(Pitch)：飞机绕左右轴的旋转角度，通常为-90°~90°</li>
<li>偏航角(Yaw)：飞机绕垂直轴的旋转角度，通常为-180°~180°</li>
</ul>
</blockquote>
<h2 id="opencv应用">opencv应用</h2>
<h3 id="色彩空间">色彩空间</h3>
<p>常见的HSV和HSL都是将RGB色彩模型表示在<strong>圆柱坐标系</strong>中的方法，该方法比笛卡尔坐标系中表示的RGB模型更加直观</p>
<ul>
<li>色相(Hue)：色彩的基本属性，即平常所说的颜色名称</li>
<li>饱和度(Saturation)：色彩的纯度，越高色彩越纯，越低色彩越灰</li>
<li>明度(Value)：也是亮度，取值在0~1之间</li>
</ul>
<blockquote>
<p>色调表示为一个圆环，范围理论上是0°~360°，在opencv中，采用一个单位表示2°，因此色调的范围是<strong>0
~
180</strong>，便于8位深度的存储，而饱和度和明度的范围在opencv中也都是8位存储，范围0
~ 255</p>
</blockquote>
<p><img src="https://i.postimg.cc/xdjCVcgK/800px-Hsl-hsv-models-svg.png" style="zoom: 50%;"></p>
<h3 id="opencv常用接口">opencv常用接口</h3>
<ol type="1">
<li><strong>色彩空间转换</strong>：将RGB转化为HSV</li>
</ol>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hsv = cv2.cvtColor(frame, cv2.BGR2HSV)</span><br></pre></td></tr></tbody></table></figure>
<ol start="2" type="1">
<li><strong>通道分割</strong></li>
</ol>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hue, sat, val = cv2.split(hsv)</span><br></pre></td></tr></tbody></table></figure>
<ol start="3" type="1">
<li><strong>图像二值化</strong></li>
</ol>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.inRange(img, lowerb, upperb, dst=<span class="literal">None</span>)</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><code>@brief</code>：根据颜色或者灰度阈值进行二值化，是用于分隔特定颜色范围的对象</li>
<li><code>@param</code>：<code>lowerb</code>
<code>upperb</code>表示阈值下界和阈值上界，
<code>dst</code>输出二值化图像，原图中在范围内的像素设置为白色(255)，在范围外的像素设置为黑色(0)</li>
</ul>
<p><img src="https://i.postimg.cc/Hkgn3Syv/image.jpg" style="zoom:50%;"></p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.threshold(img, thresh, maxval, <span class="built_in">type</span>, dst=<span class="literal">None</span>)</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><p><code>@brief</code>：适用于按照单一阈值对图像进行二值化处理，适用于<strong>灰度图像</strong>，全局阈值处理</p></li>
<li><p><code>@param</code></p>
<ul>
<li><p><code>src</code>: 输入图像，必须是单通道灰度图</p></li>
<li><p><code>thresh</code>: 阈值</p></li>
<li><p><code>maxval</code>: 超过或低于阈值时赋予的新值</p></li>
<li><p><code>type</code>: 阈值类型，如 <code>cv2.THRESH_BINARY</code>,
<code>cv2.THRESH_BINARY_INV</code> 等</p></li>
<li><p><code>dst</code>: 输出图像</p></li>
</ul></li>
</ul>
<ol type="1">
<li><strong>通道与运算</strong></li>
</ol>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.bitwise_and(src1, src2, dst=<span class="literal">None</span>, mask=<span class="literal">None</span>)</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><code>@brief</code>：该函数通常用于执行**两个图像数组*之间的按位与按操作，可以用于图像掩膜、特征提取、图像融合等</li>
<li><code>@param mask</code>：该参数是一个<strong>单通道8位图像数组</strong>，其非零像素表示在相应的<code>src1</code>和<code>src2</code>对应位置上进行。当<code>src1</code>和<code>src2</code>指向同一张图片时，表示只想对图片中的特定区域进行某种操作</li>
</ul>
<ol start="5" type="1">
<li><strong>监听键盘事件</strong></li>
</ol>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.waitKey(delay)</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><code>@param</code>：<code>delay</code>设置等待键盘输入的时间，当该时间段中没有检测到任何键盘输入就返回-1；当<code>delay</code>为0时为无限等待，直到响应键盘输入；当<code>delay</code>之为负数时，键盘输入任何按键都会结束</li>
</ul>
<h3 id="形态学处理方法">形态学处理方法</h3>
<h5 id="图像掩膜">图像掩膜</h5>
<p>图像掩膜一般是一个和原图尺寸相同的<strong>二值图像（单通道8位数组）</strong>，其像素值通常是0或255，通过图像掩膜，可以对图像的特定部分进行增强、修改和分析而不影响其他部分</p>
<h5 id="形态学转换">形态学转换</h5>
<p><strong>结构元</strong>：可以将二维结构元理解为二维数组，矩阵元素为0或1，1为有效元素，结构元尺寸小于待处理图像尺寸，注意结构元都以一个<strong>结构元原点</strong></p>
<ul>
<li><p>腐蚀：结构元<strong>整体</strong>不能超出待处理图像像素区域，其<strong>结构元原点</strong>能够经过的区域为腐蚀结果</p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.erode(img, kernel, iteration=<span class="number">1</span>)</span><br></pre></td></tr></tbody></table></figure>
<p>参数含义同<code>cv2.dilate()</code></p></li>
<li><p>膨胀：结构元只有<strong>结构元原点</strong>不能超出图像像素区域，其<strong>整体</strong>经过的像素区域为膨胀结果</p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.dilate(img, kernel, iteration=<span class="number">1</span>)</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><code>img</code>：目标图片</li>
<li><code>kernel</code>：操作内核，单通道8位图像数组</li>
<li><code>iteration</code>：膨胀次数</li>
</ul></li>
<li><p>开运算：<strong>先腐蚀后膨胀</strong>，通常用于处理灰暗背景下的高亮区域</p></li>
<li><p>闭运算：<strong>先膨胀后腐蚀</strong>，消除孔洞，填充闭合区域，删除亮背景下的灰暗区域</p>
<figure class="highlight plaintext"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.morphologyEx(src, cv2.MODE, kernel)</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><code>src</code>：目标图像，要求是<strong>单通道灰度图像</strong></li>
<li><code>cv2.MODE</code>：可使用<code>cv2.MORPH_CLOSE</code>闭操作或者<code>cv2.MORPH_OPEN</code>开操作</li>
<li><code>kernel</code>：结构元操作核</li>
</ul></li>
</ul>
<h3 id="人脸识别">人脸识别</h3>
<p>在opencv中，人脸识别采用Haar级联分类器算法，流程如下</p>
<ol type="1">
<li><p><code>face_cascade = cv2.Cascade_Classifier(filePath)</code>
加载预训练分类器中的模型，一般在opencv安装目录<code>.\opencv\sources\data\ haarcascades</code>路径下</p></li>
<li><p><code>ret, frame = cap.read()</code>读取视频中的一帧（一张图片），<code>ret</code>为获取图像是否成功，<code>frame</code>为获取到的图片对象</p></li>
<li><p><code>gray_img = cv2.cvtColor(frame, cv2.RGB2GRAY)</code>
将彩色RGB图像转化为灰度图，提高模型识别效率</p></li>
<li><p><code>faces = detectMultiScale(gray_img, scaleFactor=1.3, minNeighbors=5)</code></p>
<ul>
<li><code>@param scaleFactor</code>：前后两次相继的扫描中，搜索窗口的比例系数，此处表示搜索窗口每次扩大30%</li>
<li><code>@param minNeighbors</code>：表示构成检测目标的相邻矩阵最小个数，当一个对象检测出的矩形数量小于该数则舍弃</li>
<li><code>@return</code>：返回数组，每个元素四个成员<code>(x, y, width, height)</code></li>
</ul></li>
<li><p><code>cv2.rectangle(img, (x, y), (x + width, y + height), color, thickness: int)</code></p>
<ul>
<li><code>@param</code>：通过矩形的左上角点坐标和右下角点坐标确定矩形位置和形状，见参数列表中的两个坐标元组</li>
<li><code>@param color</code>：指定矩形框的颜色，可用RGB模式的三元组表示</li>
<li><code>@param thickness</code>：指定矩形框线条的粗细</li>
</ul></li>
<li><p><code>cv2.imshow('image', img)</code>显示人脸识别处理过的图像，字符串指定窗口名称</p></li>
</ol>
<h3 id="二维码条码识别">二维码/条码识别</h3>
<ol type="1">
<li><p>使用<code>imutils.video</code>库中的<code>VideoStream()</code>函数创建视频流</p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vs = VideoStream(src=<span class="number">0</span>).start()</span><br></pre></td></tr></tbody></table></figure></li>
<li><p>使用<code>imutils.resize()</code>方法对视频流中的每一帧进行裁剪，在该函数中<strong>单指定宽/高</strong>时，会将图像进行<strong>等比例缩放</strong></p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">frame = imtuils(frame, width=<span class="number">400</span>)</span><br></pre></td></tr></tbody></table></figure></li>
<li><p>使用<code>pyzbar</code>的核心函数<code>decode()</code></p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">barcodes = pyzbar.decode(frame)</span><br></pre></td></tr></tbody></table></figure>
<p><code>pyzbar.decode(frame)</code>返回的类型包含识别结果的<strong>各种信息属性</strong></p>
<ul>
<li><p><code>barcodes.rect</code>属性：检测到二维码矩形的<strong>左上角点坐标</strong>和<strong>长宽</strong>信息</p></li>
<li><p><code>barcodes.type</code>属性：返回读取到条码的编码类型，如<code>QRCODE</code></p></li>
<li><p><code>barcodes.data</code>属性：返回符号数据，通常为<strong>字母/数字</strong>，可以指定编码类型</p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">barCodeData = barcodes.data.decode(<span class="string">'utf-8'</span>)</span><br></pre></td></tr></tbody></table></figure></li>
</ul></li>
<li><p>框定二维码所在位置，使用<code>cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 0, 255, 2))</code></p></li>
<li><p>文本信息展示，将解析结果的<code>data</code>属性和<code>type</code>属性展示出来，使用<code>cv2.putText()</code>函数</p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.putText(frame, text, (x, y - <span class="number">10</span>), cv2.FONT_HERSHEY_SIMPLEX, <span class="number">0.5</span>, (<span class="number">0</span>, <span class="number">0</span>, <span class="number">255</span>), <span class="number">2</span>)</span><br></pre></td></tr></tbody></table></figure>
<p>接口定义如下</p>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cv2.putText(img, text, org, fontFace, fontScale, color, thickness=<span class="literal">None</span>, lineType=<span class="literal">None</span>, bottomLeftOrigin=<span class="literal">None</span>)</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><code>org</code>: 文本的左下角坐标（x,
y）。这是一个二元组（元组），指定文本在图像上的位置</li>
<li><code>fontFace</code>：字体类型</li>
<li><code>fontScale</code>：字体大小比例因子</li>
<li><code>color</code>：字体颜色</li>
<li><code>thickness</code>：文本线条粗细</li>
</ul></li>
</ol>

    </div>

    
    
    

      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/%E7%A1%AC%E4%BB%B6/" rel="tag"><i class="fa fa-tag"></i> 硬件</a>
              <a href="/tags/%E6%A0%91%E8%8E%93%E6%B4%BE/" rel="tag"><i class="fa fa-tag"></i> 树莓派</a>
              <a href="/tags/%E8%AF%BE%E5%86%85%E5%A4%8D%E4%B9%A0/" rel="tag"><i class="fa fa-tag"></i> 课内复习</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2024/04/24/%E6%95%B0%E5%80%BC%E7%A7%AF%E5%88%86%E6%96%B9%E6%B3%95/" rel="prev" title="数值积分方法">
      <i class="fa fa-chevron-left"></i> 数值积分方法
    </a></div>
      <div class="post-nav-item">
    <a href="/2024/07/02/MyBatis/" rel="next" title="MyBatis">
      MyBatis <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%A0%91%E8%8E%93%E6%B4%BE%E7%A1%AC%E4%BB%B6%E7%BB%93%E6%9E%84"><span class="nav-number">1.</span> <span class="nav-text">树莓派硬件结构</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%A0%91%E8%8E%93%E6%B4%BE4b%E7%A1%AC%E4%BB%B6%E7%BB%93%E6%9E%84"><span class="nav-number">1.1.</span> <span class="nav-text">树莓派4B硬件结构</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#pwmpulse-width-modulation"><span class="nav-number">1.2.</span> <span class="nav-text">PWM(Pulse-width modulation)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#i2c%E9%80%9A%E4%BF%A1%E5%8D%8F%E8%AE%AEinter-integrated-circuit"><span class="nav-number">1.3.</span> <span class="nav-text">I2C通信协议(Inter-Integrated
Circuit)</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E9%80%9A%E4%BF%A1%E6%96%B9%E5%BC%8F"><span class="nav-number">1.3.1.</span> <span class="nav-text">通信方式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F"><span class="nav-number">1.3.2.</span> <span class="nav-text">数据格式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E4%BF%A1%E5%8F%B7%E5%90%AB%E4%B9%89"><span class="nav-number">1.3.3.</span> <span class="nav-text">信号含义</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%85%B6%E4%BB%96%E9%80%9A%E4%BF%A1%E5%8D%8F%E8%AE%AE"><span class="nav-number">1.4.</span> <span class="nav-text">其他通信协议</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%93rpi.gpio%E5%BA%93%E7%BC%96%E7%A8%8B"><span class="nav-number">2.</span> <span class="nav-text">第三方库RPi.GPIO库编程</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%BC%95%E8%84%9A%E7%94%A8%E6%B3%95"><span class="nav-number">2.1.</span> <span class="nav-text">引脚用法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#pwm%E8%84%89%E5%86%B2%E4%BD%BF%E7%94%A8"><span class="nav-number">2.2.</span> <span class="nav-text">PWM脉冲使用</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BC%A0%E6%84%9F%E5%99%A8%E6%A8%A1%E5%9D%97"><span class="nav-number">3.</span> <span class="nav-text">传感器模块</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%9C%82%E9%B8%A3%E5%99%A8"><span class="nav-number">3.1.</span> <span class="nav-text">蜂鸣器</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%97%8B%E8%BD%AC%E7%BC%96%E7%A0%81%E5%99%A8"><span class="nav-number">3.2.</span> <span class="nav-text">旋转编码器</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#pcf8591"><span class="nav-number">3.3.</span> <span class="nav-text">PCF8591</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#mpu6050%E9%99%80%E8%9E%BA%E4%BB%AA%E5%8A%A0%E9%80%9F%E5%BA%A6%E4%BC%A0%E6%84%9F%E5%99%A8"><span class="nav-number">3.4.</span> <span class="nav-text">MPU6050陀螺仪加速度传感器</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#opencv%E5%BA%94%E7%94%A8"><span class="nav-number">4.</span> <span class="nav-text">opencv应用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%89%B2%E5%BD%A9%E7%A9%BA%E9%97%B4"><span class="nav-number">4.1.</span> <span class="nav-text">色彩空间</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#opencv%E5%B8%B8%E7%94%A8%E6%8E%A5%E5%8F%A3"><span class="nav-number">4.2.</span> <span class="nav-text">opencv常用接口</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%BD%A2%E6%80%81%E5%AD%A6%E5%A4%84%E7%90%86%E6%96%B9%E6%B3%95"><span class="nav-number">4.3.</span> <span class="nav-text">形态学处理方法</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%9B%BE%E5%83%8F%E6%8E%A9%E8%86%9C"><span class="nav-number">4.3.0.1.</span> <span class="nav-text">图像掩膜</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%BD%A2%E6%80%81%E5%AD%A6%E8%BD%AC%E6%8D%A2"><span class="nav-number">4.3.0.2.</span> <span class="nav-text">形态学转换</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BA%BA%E8%84%B8%E8%AF%86%E5%88%AB"><span class="nav-number">4.4.</span> <span class="nav-text">人脸识别</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BA%8C%E7%BB%B4%E7%A0%81%E6%9D%A1%E7%A0%81%E8%AF%86%E5%88%AB"><span class="nav-number">4.5.</span> <span class="nav-text">二维码&#x2F;条码识别</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Benson"
      src="/images/ME.ico">
  <p class="site-author-name" itemprop="name">Benson</p>
  <div class="site-description" itemprop="description">Share my thoughts with you</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">25</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/ZhouBencheng" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;ZhouBencheng" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:zhoubencheng2022@163.com" title="E-Mail → mailto:zhoubencheng2022@163.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Benson</span>
</div>

<!--
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>
-->

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>


  <script defer src="/lib/three/three.min.js"></script>
    <script defer src="/lib/three/canvas_lines.min.js"></script>


  













<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme    : 'dark',
      logLevel : 3,
      flowchart: { curve     : 'linear' },
      gantt    : { axisFormat: '%m/%d/%Y' },
      sequence : { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>


  

  

  

</body>
</html>
